package com.atwei.mango.system.account.service.impl;

import com.atwei.mango.system.account.entity.Account;
import com.atwei.mango.system.account.mapper.AccountMapper;
import com.atwei.mango.system.account.service.AccountService;
import com.atwei.mango.system.securityHandler.SysAccount;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Classname AccountService
 * @Description
 * @Date 2022/6/8 15:56
 * @Author liuwei
 */
@Service
public class AccountServiceImpl implements AccountService {

    @Resource
    AccountMapper accountMapper;

    @Override
    public Account loadAccountByName(String name){
        Account account = null;
        try{
            QueryWrapper<Account> query = Wrappers.query();
            query.eq("account_name",name);
            account = accountMapper.selectOne(query);
        }catch (MybatisPlusException e){
            e.printStackTrace();
        }
        return account;
    }
}
